package com.joseph.test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

/**
 * @description 
 * @author Joseph_Mok
 * @date 2016年3月28日下午4:51:52
 */
public class Bike implements Movable{

	@Override
	public void run() {
		System.out.println("i am bike");
	}
	
	public static void main(String[] args) {
		int size = 100000;
		List <Integer> list = new ArrayList <Integer> ();
		for (int i = 0; i< size; i++) {
			list.add(0,new Random().nextInt(150));
		}
		long start = System.currentTimeMillis();
		Integer sum = 0;
		for (Integer i : list) {
			sum += i;
		}
		for (int i = 0;i < list.size(); i++) {
			sum += list.get(i);
		}
		Iterator <Integer> iterator = list.iterator();
		while (iterator.hasNext()) {
			sum += iterator.next();
		}
		long end = System.currentTimeMillis();
		System.out.println(sum);
		System.out.println(sum/size);
		System.out.println(end - start);
		Collections.shuffle(list);
	}
	
	public void getName() {
		
	}
	
	public Integer getName(int a) {
		return 1;
	}

}
